package router

import (
	"go-blog/api"
	"go-blog/config"

	"github.com/gin-gonic/gin"
	swaggerFiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"
)

func RouterInit() *gin.Engine {
	gin.SetMode(config.Config.System.Env)
	router := gin.New()
	router.Use(gin.Recovery())
	register(router)
	return router
}

func register(router *gin.Engine) {
	router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
	router.GET("/api/success", api.Success)
	router.GET("api/failed", api.Failed)
}
